package org.neframework.webtest.service;

import java.util.List;
import java.util.Map;

import org.neframework.webtest.model.t_fk_dept;

import com.tmsps.neframework.jpa.base.BaseService;

public class DeptService extends BaseService {

	public List<Map<String, Object>> selectLocationList() {
		// TODO 查询数据
		String sql = "select * from t_fk_dept t where t.status=0 order by t.code asc";
		List<Map<String, Object>> list = jc.queryForList(sql);
		return list;
	}

	public t_fk_dept findDeptByCode(String code) {
		// TODO 根据code查询是否存在
		String sql = "select * from t_fk_dept t where t.status=0 and t.code=?";
		t_fk_dept dept = (t_fk_dept) oc.findObj(sql, new String[] { code }, t_fk_dept.class);
		return dept;
	}

	public t_fk_dept findDeptByCode(String kid, String code) {
		String sql = "select * from t_fk_dept t where t.status=0 and t.code=? and t.kid!=?";
		t_fk_dept dept = (t_fk_dept) oc.findObj(sql, new String[] { code, kid }, t_fk_dept.class);
		return dept;
	}

}
